home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Imaging / Show Image Info < prev    next >
Encoding:
Text File  |  1999-03-04  |  3.4 KB  |  109 lines  |  [TEXT/ToyS]

  1. property kasLoc : {40, 60}
  2. property gasInfos : 0
  3.  
  4.  
  5. on open fsObjs
  6.     repeat with fsObj in fsObjs
  7.         DoOne(fsObj)
  8.     end repeat
  9. end open
  10.  
  11.  
  12. on idle
  13.     return 60
  14. end idle
  15.  
  16.  
  17. on quit
  18.     if (the class of gasInfos is list) then
  19.         repeat with infW in gasInfos
  20.             set kasLoc to screen location of (display info infW with disposal)
  21.         end repeat
  22.         set gasInfos to 0
  23.     end if
  24.     continue quit
  25. end quit
  26.  
  27.  
  28. on DoOne(fsObj)
  29.     set pci to the picture info for (the image from fsObj)
  30.     set infW to (display info titled (catalog name of (basic info for fsObj)) located at kasLoc)
  31.     
  32.     -- List of windows
  33.     if the class of gasInfos is list then
  34.         set gasInfos to gasInfos & {infW}
  35.     else
  36.         set gasInfos to {infW}
  37.     end if
  38.     
  39.     set n to ShowLine(infW, 1, -1, "", "")
  40.     set n to ShowLine(infW, n, -1, "", "")
  41.     set n to ShowLine(infW, n, -1, "", "")
  42.     set n to ShowLine(infW, n, -1, "", "")
  43.     set n to ShowLine(infW, n, -1, "", "")
  44.     set n to ShowLine(infW, n, -1, "", "")
  45.     
  46.     set clr to 26 * 1024 + 29 * 32 + 26
  47.     set n to ShowLine(infW, n, clr, "Picture Size", picture size of pci)
  48.     set n to ShowLine(infW, n, clr, "Picture Bounds", RectString(picture bounds of pci))
  49.     set n to ShowLine(infW, n, clr, "Source Bounds", RectString(picture source box of pci))
  50.     
  51.     set n to ShowLine(infW, n, -1, "Colors", "")
  52.     set clr to 26 * 1024 + 26 * 32 + 29
  53.     set n to ShowLine(infW, n, clr, "Unique Colors", image colors of pci)
  54.     set n to ShowLine(infW, n, clr, "Optimal Depth", image depth of pci)
  55.     set n to ShowLine(infW, n, clr, "DPI", PointString(picture resolution of pci))
  56.     
  57.     set n to ShowLine(infW, n, -1, "Objects", "")
  58.     set clr to 29 * 1024 + 26 * 32 + 26
  59.     set n to ShowLine(infW, n, clr, "Text", picture text count of pci)
  60.     set n to ShowLine(infW, n, clr, "Lines", picture line count of pci)
  61.     set n to ShowLine(infW, n, clr, "Rectangles", picture rect count of pci)
  62.     set n to ShowLine(infW, n, clr, "Rounded Rectangles", picture rounded rect count of pci)
  63.     set n to ShowLine(infW, n, clr, "Ovals", picture oval count of pci)
  64.     set n to ShowLine(infW, n, clr, "Arcs", picture arc count of pci)
  65.     set n to ShowLine(infW, n, clr, "Polygons", picture polygon count of pci)
  66.     set n to ShowLine(infW, n, clr, "Regions", picture region count of pci)
  67.     set n to ShowLine(infW, n, clr, "Images", picture image count of pci)
  68.     set n to ShowLine(infW, n, clr, "Bitmaps", picture bits count of pci)
  69.     
  70.     set n to ShowLine(infW, n, -1, "QuickTime", "")
  71.     set clr to 29 * 1024 + 29 * 32 + 26
  72.     set n to ShowLine(infW, n, clr, "QT Images", picture compressed count of pci)
  73.     set n to ShowLine(infW, n, clr, "QT Type", picture compression of pci)
  74.     set n to ShowLine(infW, n, clr, "QT Quality", picture compressed quality of pci)
  75.     
  76.     -- Not good practice -- drawing into an info window :)
  77.     draw a picture into infW ¬
  78.         using data ((the icon for fsObj) as picture) ¬
  79.         inside of {90, 4, 154, 68}
  80. end DoOne
  81.  
  82.  
  83. on RectString(box)
  84.     return PointString(items 1 thru 2 of box) & ":" & PointString(items 3 thru 4 of box)
  85. end RectString
  86.  
  87.  
  88. on PointString(pt)
  89.     return "(" & item 1 of pt & ¬
  90.         ", " & item 2 of pt & ")"
  91. end PointString
  92.  
  93.  
  94. on ShowLine(w, lineNo, clr, lbl, txt)
  95.     set lbl to recompose lbl padded to 20
  96.     set txt to recompose txt padded to -20
  97.     display info w message (lbl & txt) at line lineNo ¬
  98.         using font "Courier" using size 10 ¬
  99.         using bg color clr
  100.     return lineNo + 1
  101. end ShowLine
  102.  
  103.  
  104. on ChooseName(prCfg)
  105.     set choice to (LAN printer name of prCfg)
  106.     if (choice is "") then set choice to print driver name of prCfg
  107.     return choice
  108. end ChooseName
  109.